1. Technical Field
This application relates to managing updating of metadata of file systems.
2. Description of Related Art
Computer systems may include different resources used by one or more host processors. Resources and host processors in a computer system may be interconnected by one or more communication connections. These resources may include, for example, data storage devices such as those included in the data storage systems manufactured by EMC Corporation. These data storage systems may be coupled to one or more servers or host processors and provide storage services to each host processor. Multiple data storage systems from one or more different vendors may be connected and may provide common data storage for one or more host processors in a computer system.
A host processor may perform a variety of data processing tasks and operations using the data storage system. For example, a host processor may perform basic system I/O operations in connection with data requests, such as data read and write operations.
Host processor systems may store and retrieve data using a storage device containing a plurality of host interface units, disk drives, and disk interface units. The host systems access the storage device through a plurality of channels provided therewith. Host systems provide data and access control information through the channels to the storage device and the storage device provides data to the host systems also through the channels. The host systems do not address the disk drives of the storage device directly, but rather, access what appears to the host systems as a plurality of logical disk units. The logical disk units may or may not correspond to the actual disk drives. Allowing multiple host systems to access the single storage device unit allows the host systems to share data in the device. In order to facilitate sharing of the data on the device, additional software on the data storage systems may also be used.
In data storage systems where high-availability is a necessity, system administrators are constantly faced with the challenges of preserving data integrity and ensuring availability of critical system components. One critical system component in any computer processing system is its file system. File systems include software programs and data structures that define the use of underlying data storage devices. File systems are responsible for organizing disk storage into files and directories and keeping track of which part of disk storage belong to which file and which are not being used.
File systems typically include metadata describing attributes of a file system and data from a user of the file system. A file system contains a range of file system blocks that store metadata and data. A user of a filesystem access the filesystem using a logical address (a relative offset in a file) and the file system converts the logical address to a physical address of a disk storage that stores the file system. Further, a user of a data storage system creates one or more files in a file system. Every file includes an index node (also referred to simply as “inode”) that contains the metadata (such as permissions, ownerships, timestamps) about that file. The contents of a file are stored in a collection of data blocks. An inode of a file defines an address map that converts a logical address of the file to a physical address of the file. Further, in order to create the address map, the inode includes direct data block pointers and indirect block pointers. A data block pointer points to a data block of a file system that contains user data. An indirect block pointer points to an indirect block that contains an array of block pointers (to either other indirect blocks or to data blocks). There may be as many as five levels of indirect blocks arranged in an hierarchy depending upon the size of a file where each level of indirect blocks includes pointers to indirect blocks at the next lower level.
A file systems store a number of timestamps for each file of the file system. The timestamps may be used to find out when a file or directory was last accessed (read from or written to), changed (file access permissions were changed) or modified (written to). When a file is modified, a timestamp such as a last modification time of the file is updated to indicate the time at which contents of the file have been modified. The last modification time (also referred to simply as “mtime”) of a file does not change when attributes such as an owner or a permission settings of the file changes. Thus, the mtime attribute of a file is used for tracking changes to contents (or data) of the file because mtime of the file changes every time contents of the file are modified. Further, the mtime attribute is a part of metadata of a file.
The accuracy and consistency of a file system is necessary to relate applications and data used by those applications. In a data storage system, hundreds of files may be created, modified, and deleted on a regular basis. Each time a file is modified, the data storage system performs a series of file system updates. These updates, when written to a disk storage reliably, yield a consistent file system. However, a file system can develop inconsistencies in several ways. Problems may result from an unclean shutdown, if a system is shut down improperly, or when a mounted file system is taken offline improperly. Inconsistencies can also result from defective hardware or hardware failures. Additionally, inconsistencies can also result from software errors or user errors.
Generally, data and metadata of a file of a file system read from a disk and written to a disk may be cached in a volatile memory such as a system cache of a data storage system. Caching of data and metadata of a file implies that read operations read data and metadata of the file from the volatile memory, rather than from a disk. Correspondingly, write operations may write data and metadata of a file to the volatile memory rather than to a disk. Data and metadata of a file cached in the volatile memory is written to the disk at intervals determined by an operating system of the data storage system, which is referred to as flushing of a cache. Flushing of a cache is triggered at a determinate time interval. Caching data and metadata of a file of a file system in a volatile memory improves performance of the file system as accessing data from a disk involves an I/O operation to a disk which is slower than accessing data from the volatile memory.
A write I/O request using a “file sync” option requires that a write operation directed to a file writes both data and metadata immediately to a disk rather than incurring a delay. However data and metadata may still be written into a cache. On the other hand, a write I/O request using a “data sync” option requires that data is written immediately to a disk but metadata may be cached and flushed to the disk at a later time.
Further, the frequency at which a cache is flushed in a data storage system affects performance and reliability of the data storage system. If the data storage system flushes the cache too often, performance of the data storage system degrades significantly as a large number of disks I/Os are performed to write data to a disk. If the data storage system does not flush the cache often enough, a volatile memory of the data storage system may be depleted by the cache, or a sudden system failure (such as a loss of power) may cause the data storage system to lose data stored in the cache.